package com.zzb.controller;

import com.zzb.DTO.ResultDTO;
import com.zzb.VO.NewsTypeVO;
import com.zzb.service.NewsTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@CrossOrigin
@RequestMapping("/back/news/type")
public class NewsTypeController {

    @Autowired
    private NewsTypeService newsTypeService;

    @GetMapping("/all")
    public ResultDTO productTypeFindAll(NewsTypeVO newsTypeVO) {
        return newsTypeService.findAll(newsTypeVO);
    }

    @GetMapping("/id")
    public ResultDTO productTypeFindById(NewsTypeVO newsTypeVO) {
        return newsTypeService.findById(newsTypeVO);
    }

    @PostMapping("/add")
    public ResultDTO productAdd(NewsTypeVO newsTypeVO) {
        return newsTypeService.add(newsTypeVO);
    }

    @PostMapping("/update")
    public ResultDTO productUpdate(NewsTypeVO newsTypeVO){
        return newsTypeService.update(newsTypeVO);
    }

    @PostMapping("/delete")
    public ResultDTO productDelete(NewsTypeVO newsTypeVO){
        return newsTypeService.delete(newsTypeVO);
    }
}
